import request from '@/utils/request'

export function create(data) {
  return request({
    url: '/api/v1/StorageOrderOut/Create',
    method: 'post',
    data
  })
}

export function deleteRecord(data) {
  return request({
    url: '/api/v1/StorageOrderOut/Delete',
    method: 'delete',
    data
  })
}

export function update(data) {
  return request({
    url: '/api/v1/StorageOrderOut/Update',
    method: 'post',
    data
  })
}

export function getList(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  return request({
    url: '/api/v1/StorageOrderOut/GetList',
    method: 'get',
    params: data
  })
}

export function getStorageList() {
  const data = {};
  data["status"] = 1;
  data["pageIndex"] = 1;
  data["pageSize"] = 50000;
  return request({
    url: '/api/v1/Storage/GetList',
    method: 'get',
    params: data
  })
}

export function getInfo(data) {
  return request({
    url: '/api/v1/StorageOrderOut/Get',
    method: 'get',
    params: data
  })
}
// 作废
export function invalidOrder(data) {
  return request({
    url: '/api/v1/StorageOrderOut/Invalid',
    method: 'post',
    data: data
  })
}
// 处理中
export function inProgressOrder(data) {
  return request({
    url: '/api/v1/StorageOrderOut/InProgress',
    method: 'post',
    data: data
  })
}
// 处理完成
export function completeOrder(data) {
  return request({
    url: '/api/v1/StorageOrderOut/Complete',
    method: 'post',
    data: data
  })
}

export function getStorageAreaList(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  return request({
    url: '/api/v1/StorageArea/GetList',
    method: 'get',
    params: data
  })
}

export function getStorageSpaceList(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  return request({
    url: '/api/v1/StorageSpace/GetList',
    method: 'get',
    params: data
  })
}

export function getStorageProductStoreDetailsList(data) {
  return request({
    url: '/api/v1/StorageProductStoreDetails/GetSerialNumList',
    method: 'get',
    params: data
  })
}

export function getStorageProductBatchList(data, pagination) {
  if (pagination) {
    data["pageIndex"] = pagination.pageIndex;
    data["pageSize"] = pagination.pageSize;
  }
  return request({
    url: '/api/v1/StorageProductBatch/GetList',
    method: 'get',
    params: data
  })
}

export function getSpaceSnList(data) {
  return request({
    url: '/api/v1/StorageProductStoreDetails/GetSpaceSnList',
    method: 'get',
    params: data
  })
}

